package edu.ahut.corejava3;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class LinkedListDemo {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();


        List<Integer> list = new LinkedList<Integer>();
        //List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < 200000; i++) {

            list.add(i);

        }


//        for (int i = 0; i < list.size(); i++) {//O(n^2)
//            System.out.println(list.get(i));
//        }
        Iterator<Integer> it=list.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }


        long end = System.currentTimeMillis();
        System.out.println((end - start) / 1000.0 + " second(s).");
    }
}
